<div class="action-dialog-model-fixed-body selectW70">
<div class="detailsBox">
      <h3 class="mt20"><i class="jtIco"></i> 总部归档</h3>
       <form id="archiveBorrowRecordForm" action="/archive/rest/v1/saveArchiveBorrowRecords" class="action-ajax-form" method="post">
           <div class="cktitle" style="margin-top:10px;"><span class="xiala"></span>借阅申请信息</div>
		   <div class="m10 detaiTab" style="border-right:1px solid #e1e1e1; border-left:1px solid #e1e1e1">
		        <table data="${FORMTYPE_BANK}" width="100%" border="0" cellspacing="0" cellpadding="0" class="b_t_e5">
		            <tbody>
	            	 	<tr>
	            	 	 <td align="right" class="bg " width="25%"><span><font color="red">*</font></span>申请人</td>
                         <td><input type="text" name="proposer" value="${currentUser.cname}"></td>
                         <td align="right" class="bg " width="25%"><span><font color="red">*</font></span>预计归还时间</td>
                         <td><@date name="pre_return_time" value="${archiveBorrow.pre_return_time}"/></td>
	                    </tr>
	                    <tr>
	            	 	 <td align="right" class="bg " width="25%"><span><font color="red">*</font></span>借阅原因</td>
                         <td colspan="3">
                         	<textarea rows="3" cols="50" name="borrowDes">${archiveBorrow.borrowDes}</textarea>
                         </td>
	                    </tr>
		            </tbody>
		        </table> 
		    </div>
            <@include file="/archive/v1/borrowMode2"/>
            <input name="bid" value="${bid}" type="hidden"/>
            <input name="loanapply_no" type="hidden" value="${loanapplyNo}"/>
            <input id="${FORMTYPE_FINANCE}_contentJson" name="cw_contentJson" type="hidden"/>
            <input id="${FORMTYPE_ARCHIVE_INFO}_contentJson" name="ck_contentJson" type="hidden"/>
            <input id="dc_contentJson" name="dc_contentJson" type="hidden"/>
            </form>
    </div>
  <div class=" mtb20 tac">
  	<span id="archiveErrorMsg" style="disploy:none;" class="red"></span></br>
	<a id="saveBorrowBtn" href="javascript:void(0);" class="btn_auto_30 btn_blue">保 存</a>
  </div>
 </div> 
<@js>
	$('#archiveBorrowRecordForm select[name="ck"]').attr('disabled','disabled');
	$('#archiveBorrowRecordForm select[name="sy"]').attr('disabled','disabled');
	$('#archiveBorrowRecordForm #archiveNoInpu').attr('disabled','disabled');
	$('input[name="proposer"]').attr('disabled','disabled');
	$("#saveBorrowBtn").click(function(){
		var errorMsg="";
		var loanapplyNo=$('#loanapplyNoArchive').val();
		
		var borrowDes=$('#archiveBorrowRecordForm  textarea[name="borrowDes"]').val();
		if(!borrowDes){
			$('#archiveErrorMsg').text("借阅原因不能为空!").show();
			return;
		}
		var pre_return_time=$('#archiveBorrowRecordForm  input[name="pre_return_time"]').val();
		if(!pre_return_time){
			$('#archiveErrorMsg').text("预计归还时间不能为空!").show();
			return;
		}
		
		$('#archiveBorrowRecordForm table').each(function(i,item){
		debugger;
			var formTypeId=$(item).attr('data');
			if(!formTypeId)
				return true;
			var contentJson={};
			$(item).find('.fieldVaule').each(function(f,field){
				var key=$(field).attr('data');
				var ck=$(field).find('select[name="ck"]').val();
				var sy=$(field).find('select[name="sy"]').val();
				var jy=$(field).find('select[name="jy"]').val();
				contentJson[key+'_ck']=ck;
				contentJson[key+'_sy']=sy;
				contentJson[key+'_jy']=jy;
			});
			$('#'+formTypeId+'_contentJson').val(JSON.stringify(contentJson));
		});
		
		var _dom=[];
		$('#archiveBorrowRecordForm #dcInfoTable .dcField').each(function(i,item){
			var fieldName=$(item).attr('data');
			
			var _ck=$(item).find('select[name="ck"]').val();
			_dom.push('<input name="'+fieldName+'_ck" value="'+_ck+'" type="hidden"/>');
			
			var _sy=$(item).find('select[name="sy"]').val();
			_dom.push('<input name="'+fieldName+'_sy" value="'+_sy+'" type="hidden"/>');
			
			var _jy=$(item).find('select[name="jy"]').val();
			_dom.push('<input name="'+fieldName+'_jy" value="'+_jy+'" type="hidden"/>');
		});		
		$('#archiveBorrowRecordForm').append(_dom.join(''));
		
		$('#archiveErrorMsg').text('').hide();
		$('#archiveBorrowRecordForm').submit();
   });
</@js>
<@jsRender/>